﻿using HotelBooking;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;


namespace HotelBooking
{
    static class Program
    {

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        public static String Log = String.Empty;
        static void Main()
        {

            //N=5
            TravelAgency ag0 = new TravelAgency(0, 5001);
            TravelAgency ag1 = new TravelAgency(1, 6020);
            TravelAgency ag2 = new TravelAgency(2, 5236);
            TravelAgency ag3 = new TravelAgency(3, 5203);
            TravelAgency ag4 = new TravelAgency(4, 6325);

            //K = 3
            HotelSuplier h0 = new HotelSuplier(0, 10, 1, 100.00f);
            HotelSuplier h1 = new HotelSuplier(1, 50, 20, 250.00f);
            HotelSuplier h2 = new HotelSuplier(2, 100, 60, 155.00f);

            MultiCellBuffer semaphore = new MultiCellBuffer();

            h0.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag0.EvaluatePrice);
            h0.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag1.EvaluatePrice);
            h0.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag2.EvaluatePrice);
            h0.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag3.EvaluatePrice);
            h0.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag4.EvaluatePrice);

            h1.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag0.EvaluatePrice);
            h1.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag1.EvaluatePrice);
            h1.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag2.EvaluatePrice);
            h1.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag3.EvaluatePrice);
            h1.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag4.EvaluatePrice);

            h2.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag0.EvaluatePrice);
            h2.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag1.EvaluatePrice);
            h2.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag2.EvaluatePrice);
            h2.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag3.EvaluatePrice);
            h2.PriceHasDecreased += new HotelSuplier.PromotionHandler(ag4.EvaluatePrice);



            ag0.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);
            ag1.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);
            ag2.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);
            ag3.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);
            ag4.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);

            ag0.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);
            ag1.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);
            ag2.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);
            ag3.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);
            ag4.TravelSentOrder += new TravelAgency.TravelHandler(semaphore.receivesString);

            semaphore.sendOrderToHotel += new MultiCellBuffer.OrderToHotelHandler(h0.ReceiveOrder);
            semaphore.sendOrderToHotel += new MultiCellBuffer.OrderToHotelHandler(h1.ReceiveOrder);
            semaphore.sendOrderToHotel += new MultiCellBuffer.OrderToHotelHandler(h2.ReceiveOrder);



            h0.PricingModel();
            h1.PricingModel();
            h2.PricingModel();


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1 f = new Form1();
            Application.Run(f);
            f.changeText();
           
        }
    }
}
